/*----------------------------------------------------------------------------
The contents of this file are subject to the Mozilla Public License
Version 1.1 (the "License"); you may not use this file except in
compliance with the License. You may obtain a copy of the 
License at http://www.mozilla.org/MPL/
	
Software distributed under the License is distributed on 
an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, 
either express or implied. 
See the License for the specific language governing rights and 
limitations under the License.
	
The Original Code is Fever RS ( ActionScript 3 ) Framework code.
	
The Initial Developer of the Original Code is Romain Ecarnot.
Portions created by Initial Developer are Copyright (C) 2006
the Initial Developer. All Rights Reserved.
	
Contributor(s):
	
Unless required by applicable law or agreed to in writing, 
software distributed under the License is distributed on 
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 
OF ANY KIND, either express or implied.
See the License for the specific language governing permissions 
and limitations under the License.
----------------------------------------------------------------------------*/

package fever.load 
{
	import flash.events.Event;
	
	import com.bourre.load.LoaderEvent;	

	/**
	 * The CipherXMLLoaderEvent class represents the event object passed to the event 
	 * listener for <strong>CipherXMLLoader</strong> events.
	 * 
	 * @see fever.load.CipherXMLLoader
	 * 
	 * @author Romain Ecarnot
	 */
	public class CipherXMLLoaderEvent extends LoaderEvent
	{
		//--------------------------------------------------------------------
		// Events
		//--------------------------------------------------------------------
		
		/**
		 * Defines the value of the <code>type</code> property of the event 
		 * object for a <code>onLoadStart</code> event.
		 * 
		 * <p>The properties of the event object have the following values:</p>
	     *  <table class="innertable">
	     *     <tr><th>Property</th><th>Value</th></tr>
	     *     <tr>
	     *     	<td><code>target</code></td>
	     *     	<td>The Object that defines the event listener that handles the event</td>
	     *     </tr>
	     *     <tr>
	     *     	<td><code>type</code></td>
	     *     	<td>Dispatched event type</td>
	     *     </tr>
	     *     
	     *     <tr><th>Method</th><th>Value</th></tr>
	     *     <tr>
	     *     	<td><code>getTarget()</code>
	     *     	</td><td>The Object that defines the
	     *       event listener that handles the event</td></tr>
	     *     <tr>
	     *     	<td><code>getType()</code></td>
	     *     	<td>Dispatched event type</td>
	     *     </tr>
	     *     <tr>
	     *     	<td><code>getXMLLoader()</code></td>
	     *     	<td><code>SecureXMLLoader</code> target</td>
	     *     </tr>
	     *     <tr>
	     *     	<td><code>getXML()</code></td>
	     *     	<td>Loaded XML content</td>
	     *     </tr>
	     *  </table>
	     * 
		 * @eventType onLoadStart
		 */		
		public static const onLoadStartEVENT : String = LoaderEvent.onLoadStartEVENT;
		
		/**
		 * Defines the value of the <code>type</code> property of the event 
		 * object for a <code>onLoadInit</code> event.
		 * 
		 * <p>The properties of the event object have the following values:</p>
	     *  <table class="innertable">
	     *     <tr><th>Property</th><th>Value</th></tr>
	     *     <tr>
	     *     	<td><code>target</code></td>
	     *     	<td>The Object that defines the event listener that handles the event</td>
	     *     </tr>
	     *     <tr>
	     *     	<td><code>type</code></td>
	     *     	<td>Dispatched event type</td>
	     *     </tr>
	     *     
	     *     <tr><th>Method</th><th>Value</th></tr>
	     *     <tr>
	     *     	<td><code>getTarget()</code>
	     *     	</td><td>The Object that defines the
	     *       event listener that handles the event</td></tr>
	     *     <tr>
	     *     	<td><code>getType()</code></td>
	     *     	<td>Dispatched event type</td>
	     *     </tr>
	     *     <tr>
	     *     	<td><code>getXMLLoader()</code></td>
	     *     	<td><code>SecureXMLLoader</code> target</td>
	     *     </tr>
	     *     <tr>
	     *     	<td><code>getXML()</code></td>
	     *     	<td>Loaded XML content</td>
	     *     </tr>
	     *  </table>
	     * 
		 * @eventType onLoadInit
		 */		
		public static const onLoadInitEVENT : String = LoaderEvent.onLoadInitEVENT;
		
		/**
		 * Defines the value of the <code>type</code> property of the event 
		 * object for a <code>onLoadProgress</code> event.
		 * 
		 * <p>The properties of the event object have the following values:</p>
	     *  <table class="innertable">
	     *     <tr><th>Property</th><th>Value</th></tr>
	     *     <tr>
	     *     	<td><code>target</code></td>
	     *     	<td>The Object that defines the event listener that handles the event</td>
	     *     </tr>
	     *     <tr>
	     *     	<td><code>type</code></td>
	     *     	<td>Dispatched event type</td>
	     *     </tr>
	     *     
	     *     <tr><th>Method</th><th>Value</th></tr>
	     *     <tr>
	     *     	<td><code>getTarget()</code>
	     *     	</td><td>The Object that defines the
	     *       event listener that handles the event</td></tr>
	     *     <tr>
	     *     	<td><code>getType()</code></td>
	     *     	<td>Dispatched event type</td>
	     *     </tr>
	     *     <tr>
	     *     	<td><code>getXMLLoader()</code></td>
	     *     	<td><code>SecureXMLLoader</code> target</td>
	     *     </tr>
	     *  </table>
	     * 
		 * @eventType onLoadProgress
		 */	
		public static const onLoadProgressEVENT : String = LoaderEvent.onLoadProgressEVENT;
		
		/**
		 * Defines the value of the <code>type</code> property of the event 
		 * object for a <code>onLoadTimeOut</code> event.
		 * 
		 * <p>The properties of the event object have the following values:</p>
	     *  <table class="innertable">
	     *     <tr><th>Property</th><th>Value</th></tr>
	     *     <tr>
	     *     	<td><code>target</code></td>
	     *     	<td>The Object that defines the event listener that handles the event</td>
	     *     </tr>
	     *     <tr>
	     *     	<td><code>type</code></td>
	     *     	<td>Dispatched event type</td>
	     *     </tr>
	     *     
	     *     <tr><th>Method</th><th>Value</th></tr>
	     *     <tr>
	     *     	<td><code>getTarget()</code>
	     *     	</td><td>The Object that defines the
	     *       event listener that handles the event</td></tr>
	     *     <tr>
	     *     	<td><code>getType()</code></td>
	     *     	<td>Dispatched event type</td>
	     *     </tr>
	     *     <tr>
	     *     	<td><code>getXMLLoader()</code></td>
	     *     	<td><code>SecureXMLLoader</code> target</td>
	     *     </tr>
	     *  </table>
	     * 
		 * @eventType onLoadTimeOut
		 */	
		public static const onLoadTimeOutEVENT : String = LoaderEvent.onLoadTimeOutEVENT;
		
		/**
		 * Defines the value of the <code>type</code> property of the event 
		 * object for a <code>onLoadError</code> event.
		 * 
		 * <p>The properties of the event object have the following values:</p>
	     *  <table class="innertable">
	     *     <tr><th>Property</th><th>Value</th></tr>
	     *     <tr>
	     *     	<td><code>target</code></td>
	     *     	<td>The Object that defines the event listener that handles the event</td>
	     *     </tr>
	     *     <tr>
	     *     	<td><code>type</code></td>
	     *     	<td>Dispatched event type</td>
	     *     </tr>
	     *     
	     *     <tr><th>Method</th><th>Value</th></tr>
	     *     <tr>
	     *     	<td><code>getTarget()</code>
	     *     	</td><td>The Object that defines the
	     *       event listener that handles the event</td></tr>
	     *     <tr>
	     *     	<td><code>getType()</code></td>
	     *     	<td>Dispatched event type</td>
	     *     </tr>
	     *     <tr>
	     *     	<td><code>getXMLLoader()</code></td>
	     *     	<td><code>SecureXMLLoader</code> target</td>
	     *     </tr>
	     *  </table>
	     * 
		 * @eventType onLoadError
		 */	
		public static const onLoadErrorEVENT : String = LoaderEvent.onLoadErrorEVENT;
		
		
		//--------------------------------------------------------------------
		// Public API
		//--------------------------------------------------------------------
		
		/**
		 * Constructor.
		 * 
		 * @param type Event type
		 * @param xl XML loader instance
		 */
		public function CipherXMLLoaderEvent( type : String, xl : CipherXMLLoader )
		{
			super( type, xl );
		}
		
		/**
		 * Returns xml loader.
		 */
		public function getXMLLoader() : CipherXMLLoader
		{
			return getLoader() as CipherXMLLoader;
		}
		
		/**
		 * Returns xml content.
		 */
		public function getXML() : XML
		{
			return getXMLLoader().getXML();
		}
		
		/**
		 * Returns event instance clone.
		 */
		override public function clone( ) : Event
		{
			return new CipherXMLLoaderEvent( _sType, getXMLLoader() );	
		}
	}
}
